package top.buyibuyi.course.controller.admin;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.buyibuyi.course.R;
import top.buyibuyi.course.service.admin.DeleteAdminService;

@RestController
@RequestMapping("/admin")
@CrossOrigin
public class DeleteAdminController {

    @Autowired
    private DeleteAdminService deleteAdminService;

    @DeleteMapping("/deleteAdmin/{id}")
    public R deleteAdmin(@PathVariable int id){
        System.out.println("删除==》"+id);
        try {
            Boolean aBoolean = deleteAdminService.deleteAdminById(id);
            return R.ok().data("data",aBoolean);
        }catch (Exception e){
            e.printStackTrace();
            return R.error();
        }
    }
}
